#include "CLogger.h"


CLogger::~CLogger()
{

	LogFile<<"</head>"<<std::endl;
	LogFile<<"</body>"<<std::endl;
	LogFile.close();

}
CLogger::CLogger()
{
	LogFile.open("Engine Log.html");

	LogFile<<"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd <"<<std::endl;	
	LogFile<<"<html>"<<std::endl;
	LogFile<<"<head>"<<std::endl;
	LogFile<<"<title> GameEngine Log System </title>"<<std::endl;
	LogFile<<"</head>"<<std::endl;
	LogFile<<"<body>"<<std::endl;
	LogFile<<"<body bgcolor=#FFFFFFFF>"<<std::endl;
	LogFile<<"<h3 align=\"center\"> GameEngine Log System  </h3>"<<std::endl;
	LogFile<<"<Br>"<<std::endl;
	LogFile<<"<Br>"<<std::endl;
}

void CLogger::WriteLog(std::string Message, CLogger::MessageType Type)
{
	if(Type==MSG_EVENT)
	{
		LogFile<<"<Font color=green>"<<"<b>Event</b>"<<"</Font>"<<"<b>: </b>"<<Message.c_str()<<"<BR>"<<std::endl;
	}
	if(Type==MSG_ERROR)
	{
		LogFile<<"<Font color=red>"<<"<b>Error</b>"<<"</Font>"<<"<b>: </b>"<<Message.c_str()<<"<BR>"<<std::endl;
	}
	if(Type==MSG_SUCCEEDED)
	{
		LogFile<<"<b>Succeeded</b>"<<"<b>: </b>"<<Message.c_str()<<"<BR>"<<std::endl;
	}
	if(Type==MSG_IMPORTANT)
	{
		LogFile<<"<b>Important</b>"<<"<b>: </b>"<<Message.c_str()<<"<BR>"<<std::endl;
	}
}

void CLogger::WriteVector2(D3DXVECTOR2 vector)
{
	LogFile<<"<b>2D Vektor</b>"<<"<b>: </b>"<<vector.x<<" "<<vector.y<<"<BR>"<<std::endl;
}

void CLogger::WriteVector3(D3DXVECTOR3 vector)
{
	LogFile<<"<b>3D Vektor</b>"<<"<b>: </b>"<<vector.x<<" "<<vector.y<<" "<<vector.z<<"<BR>"<< std::endl;
}

void CLogger::SetPageTitle(std::string PageTitle)
{
	LogFile<<"<title>"<< PageTitle.c_str() << "</title>"<<std::endl;
}
void CLogger::SetBackGroundColor(std::string backcolor)
{
	LogFile<<"<body bgcolor="<<backcolor.c_str()<<">"<<std::endl;
}
void CLogger::SetHeadLine(std::string Headline)
{
	LogFile<<"<h3 align=\"center\">"<< Headline.c_str()<<"</h3>"<<std::endl;
}

void CLogger::PutLink(std::string Link)
{
	LogFile<<"<h3>"<<"<center>"<<"<a href=http://"<<Link.c_str()<<">"<<Link.c_str()<<"</a>"<<"</center>"<<"</h3>"<<std::endl; 
	
}